import {Enemy, Player} from "./Tank.ts";


export class Level {
    enemies = 20
    left = 3
    existEnemies = 0

    start() {
        new Player(160, 400).reg()
        this.newEnemy()
        this.newEnemy()
        this.newEnemy()
    }

    enemyDie() {
        this.enemies--
        this.existEnemies--
        if (this.enemies > 0){
            this.newEnemy()
        }
        if (this.existEnemies <= 0) {
            alert('You Win')
        }
    }

    newEnemy() {
        new Enemy(16, 16).reg()
        this.existEnemies++
        this.enemies--
    }

    newPlayer() {
        new Player(160, 400).reg()
    }
}